Skip to content

ci: add CI workflows, golangci-lint config, and release pipeline#2

Merged
pan93412 merged 2 commits into
mainfrom
improve-release
May 8, 2026
Merged

ci: add CI workflows, golangci-lint config, and release pipeline#2
pan93412 merged 2 commits into
mainfrom
improve-release

Conversation

@pan93412

@pan93412 pan93412 commented May 8, 2026

Copy link
Copy Markdown
Member

Summary

  • Add .golangci.yml (v2 format): standard linters + modernize, formatter gofumpt
  • Add tests.yml: lint/format check and unit tests via Nix, runs on PRs and pushes to main
  • Add release.yml: builds on PRs to validate, pushes to Docker Hub and Huawei SWR on v* tag push

Test plan

  • Verify tests.yml lint and unit jobs pass on this PR
  • Verify release.yml build job passes on this PR (no push expected)
  • After merge, push a v* tag and confirm images appear on both docker.io/zeabur/stratus and swr.cn-east-3.myhuaweicloud.com/zeabur/stratus

🤖 Generated with Claude Code


View in Codesmith
Need help on this PR? Tag @codesmith with what you need.

  • Let Codesmith autofix CI failures and bot reviews

Summary by CodeRabbit

  • Chores
    • Added automated release workflow that builds per-architecture images (amd64/arm64), publishes multi‑arch manifests to Docker Hub and Huawei SWR with versioned tags, and enforces concurrency and tightened permissions.
    • Updated Go module dependencies to newer versions.
  • Tests
    • Added CI workflow for linting and unit tests with concurrency controls and least‑privilege permissions.
  • Style
    • Tightened linter configuration and minor import/formatting adjustments.

Copilot AI review requested due to automatic review settings May 8, 2026 15:11
@coderabbitai

coderabbitai Bot commented May 8, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR adds CI/CD workflows (Tests and Release), updates go.mod dependency versions, adjusts golangci-lint config, and reformats an example import line.

Changes

CI/CD Infrastructure and Dependency Updates

Layer / File(s) Summary
Go Dependency Updates
go.mod
Direct dependencies bumped: github.com/gofiber/fiber/v3 → v3.2.0, github.com/minio/minio-go/v7 → v7.1.0, github.com/samber/slog-fiber → v1.22.2; several indirect versions updated and some indirect entries removed/reorganized.
Go Linter Configuration
.golangci.yml
Config version: "2", run.timeout: 5m, linters.enable: modernize, and formatters: gofumpt enabled.
Example Formatting
examples/push-image/main.go
Minor import reformatting only; no behavioral changes.
Test Workflow
.github/workflows/tests.yml
Adds Tests workflow with lint and unit jobs using Nix/flakehub cache; triggers on push to main, PRs, and manual dispatch; uses concurrency and least-privilege permissions.
Release Workflow
.github/workflows/release.yml
Adds Release workflow triggered on tag pushes (v*), PRs, and manual dispatch; extracts version from tag ref, sets up Docker Buildx/QEMU, builds per-architecture images (linux/amd64, linux/arm64), and publishes multi-arch manifests to Docker Hub and Huawei SWR.

🎯 3 (Moderate) | ⏱️ ~20 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main changes: adding CI workflows (tests.yml, release.yml), golangci-lint configuration, and a release pipeline for Docker/SWR publishing.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch improve-release

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: a5660e90bb

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/release.yml Outdated

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Go lint/format and test automation plus a Docker image release workflow, aligned with the repo’s Nix-based dev environment.

Changes:

  • Add .golangci.yml (v2) enabling standard linters + modernize and gofumpt formatting.
  • Add GitHub Actions workflow for lint/format checks and unit tests via nix develop.
  • Add GitHub Actions release workflow to build and push multi-arch images to Docker Hub and Huawei SWR on v* tags.

Reviewed changes

Copilot reviewed 4 out of 6 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
go.mod Updates Go dependencies (notably Fiber/MinIO/slog-fiber) and removes several previously-required modules.
go.sum Updates module checksums in line with dependency changes.
flake.lock Updates pinned nixpkgs revision for the Nix flake environment.
.golangci.yml Introduces golangci-lint v2 config with modernize + gofumpt.
.github/workflows/tests.yml Adds Nix-based lint/format and go test ./... CI on PRs and main.
.github/workflows/release.yml Adds PR build validation and tag-based image publishing pipeline using docker buildx bake.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread go.mod
Comment thread .github/workflows/release.yml Outdated
@pan93412
pan93412 marked this pull request as draft May 8, 2026 15:17
@pan93412
pan93412 force-pushed the improve-release branch from 408df81 to 23d9121 Compare May 8, 2026 15:19

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
.github/workflows/release.yml (1)

16-16: ⚡ Quick win

Verify the runner label resolution.

On Line 16, blacksmith-2vcpu-ubuntu-2404-arm is not recognized by standard actionlint labels. If this is intentional custom infra, add the corresponding actionlint config; otherwise switch to a supported ARM label.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml at line 16, The runner label
"blacksmith-2vcpu-ubuntu-2404-arm" used in the workflow is not recognized by
actionlint; either register this custom label in your actionlint configuration
or replace it with a supported ARM runner label (e.g., a standard GitHub-hosted
ARM label or "self-hosted" group) to ensure actionlint passes; update the
workflow to use the new label or add the custom mapping so the label resolution
for "blacksmith-2vcpu-ubuntu-2404-arm" is valid.
.github/workflows/tests.yml (1)

21-21: ⚡ Quick win

Verify runner label is intentionally custom in both jobs.

On Lines 21 and 41, blacksmith-2vcpu-ubuntu-2404-arm may fail validation unless your runner ecosystem/actionlint config explicitly supports it.

Also applies to: 41-41

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/tests.yml at line 21, The workflow uses a nonstandard
runner label 'blacksmith-2vcpu-ubuntu-2404-arm' in the runs-on key (appearing
twice); verify that this exact label is registered in your self-hosted runner
pool or supported by your actionlint/config, otherwise replace both occurrences
with a valid runner label (e.g., a registered self-hosted label or a standard
GitHub runner like 'ubuntu-24.04'/'ubuntu-latest') or document the custom label
in your CI setup so validation and other jobs won’t fail.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.github/workflows/release.yml:
- Around line 28-42: The steps "Login to Docker Hub" and "Login to Huawei SWR"
currently gate on the expression github.event_name != 'pull_request', which
still allows workflow_dispatch and can publish non-version tags; change the
conditional so these steps only run for version-tag pushes—for example require
github.event_name == 'push' and that github.ref is a tag (use
startsWith(github.ref, 'refs/tags/') or github.ref_type == 'tag') so the
login/publish logic in this workflow only executes for tag pushes (affecting the
steps named "Login to Docker Hub" and "Login to Huawei SWR" and any subsequent
publish steps that rely on GITHUB_REF_NAME).

---

Nitpick comments:
In @.github/workflows/release.yml:
- Line 16: The runner label "blacksmith-2vcpu-ubuntu-2404-arm" used in the
workflow is not recognized by actionlint; either register this custom label in
your actionlint configuration or replace it with a supported ARM runner label
(e.g., a standard GitHub-hosted ARM label or "self-hosted" group) to ensure
actionlint passes; update the workflow to use the new label or add the custom
mapping so the label resolution for "blacksmith-2vcpu-ubuntu-2404-arm" is valid.

In @.github/workflows/tests.yml:
- Line 21: The workflow uses a nonstandard runner label
'blacksmith-2vcpu-ubuntu-2404-arm' in the runs-on key (appearing twice); verify
that this exact label is registered in your self-hosted runner pool or supported
by your actionlint/config, otherwise replace both occurrences with a valid
runner label (e.g., a registered self-hosted label or a standard GitHub runner
like 'ubuntu-24.04'/'ubuntu-latest') or document the custom label in your CI
setup so validation and other jobs won’t fail.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 9e96178e-f16a-4815-bd79-84eef754501a

📥 Commits

Reviewing files that changed from the base of the PR and between ee8e463 and a5660e9.

⛔ Files ignored due to path filters (2)
  • flake.lock is excluded by !**/*.lock
  • go.sum is excluded by !**/*.sum
📒 Files selected for processing (4)
  • .github/workflows/release.yml
  • .github/workflows/tests.yml
  • .golangci.yml
  • go.mod

Comment thread .github/workflows/release.yml
@pan93412
pan93412 force-pushed the improve-release branch from 23d9121 to 585b95a Compare May 8, 2026 15:21

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52389b2c0f

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/release.yml Outdated
@pan93412
pan93412 force-pushed the improve-release branch 6 times, most recently from 562c2b1 to 45a771c Compare May 8, 2026 15:42
@pan93412
pan93412 marked this pull request as ready for review May 8, 2026 15:45
@pan93412
pan93412 requested a review from Copilot May 8, 2026 15:45

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
.github/workflows/release.yml (2)

52-53: 💤 Low value

Consider adding explicit cache scope for consistency with arm64 job.

The arm64 build uses an explicit scope=buildkit-linux-arm64 for cache isolation, but amd64 relies on the default scope. While this works, adding an explicit scope improves clarity and prevents potential cache collisions.

Suggested fix
-          cache-from: type=gha
-          cache-to: type=gha,mode=max
+          cache-from: type=gha,scope=buildkit-linux-amd64
+          cache-to: type=gha,mode=max,scope=buildkit-linux-amd64
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml around lines 52 - 53, The AMD64 job cache
entries (cache-from and cache-to) lack an explicit scope; add a unique scope
(e.g., scope=buildkit-linux-amd64) to both cache-from and cache-to to mirror the
arm64 job's isolation and avoid collisions, updating the cache configuration
lines that currently read "cache-from: type=gha" and "cache-to:
type=gha,mode=max" to include the scope parameter.

21-21: 💤 Low value

Blacksmith runner labels cause actionlint false positives.

The blacksmith-2vcpu-ubuntu-2404 and blacksmith-2vcpu-ubuntu-2404-arm labels are valid for Blacksmith infrastructure but aren't recognized by actionlint. To suppress these warnings, add an .github/actionlint.yaml:

self-hosted-runner:
  labels:
    - blacksmith-2vcpu-ubuntu-2404
    - blacksmith-2vcpu-ubuntu-2404-arm
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/release.yml at line 21, Add an .github/actionlint.yaml to
suppress actionlint warnings for Blacksmith runner labels by declaring the
`self-hosted-runner` labels and listing `blacksmith-2vcpu-ubuntu-2404` and
`blacksmith-2vcpu-ubuntu-2404-arm`; this will stop actionlint from flagging the
`runs-on: blacksmith-2vcpu-ubuntu-2404` (and the ARM variant) in the release.yml
workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/release.yml:
- Around line 52-53: The AMD64 job cache entries (cache-from and cache-to) lack
an explicit scope; add a unique scope (e.g., scope=buildkit-linux-amd64) to both
cache-from and cache-to to mirror the arm64 job's isolation and avoid
collisions, updating the cache configuration lines that currently read
"cache-from: type=gha" and "cache-to: type=gha,mode=max" to include the scope
parameter.
- Line 21: Add an .github/actionlint.yaml to suppress actionlint warnings for
Blacksmith runner labels by declaring the `self-hosted-runner` labels and
listing `blacksmith-2vcpu-ubuntu-2404` and `blacksmith-2vcpu-ubuntu-2404-arm`;
this will stop actionlint from flagging the `runs-on:
blacksmith-2vcpu-ubuntu-2404` (and the ARM variant) in the release.yml workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 748148e3-a587-4c2a-a4ba-90441e4291bc

📥 Commits

Reviewing files that changed from the base of the PR and between a5660e9 and 45a771c.

📒 Files selected for processing (4)
  • .github/workflows/release.yml
  • .github/workflows/tests.yml
  • .golangci.yml
  • examples/push-image/main.go
✅ Files skipped from review due to trivial changes (2)
  • examples/push-image/main.go
  • .golangci.yml

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 7 changed files in this pull request and generated 1 comment.

Comment thread .github/workflows/release.yml Outdated
- Add .golangci.yml (v2 format): standard linters + modernize, formatter gofumpt
- Add tests.yml: lint/format check and unit tests via Nix on PRs and pushes to main
- Add release.yml: build on PRs (VERSION=0.0.0), push to Docker Hub and Huawei SWR
  on v* tag push; GHA cache enabled with mode=max

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@pan93412
pan93412 force-pushed the improve-release branch from 45a771c to 6870e4b Compare May 8, 2026 15:49

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
.github/workflows/tests.yml (1)

21-21: 💤 Low value

Custom runner label flagged by actionlint.

The blacksmith-2vcpu-ubuntu-2404-arm label is a valid Blacksmith runner, but actionlint doesn't recognize it. Consider adding an .github/actionlint.yaml config to declare custom runner labels if you want to silence these warnings:

self-hosted-runner:
  labels:
    - blacksmith-2vcpu-ubuntu-2404-arm
    - blacksmith-2vcpu-ubuntu-2404
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/tests.yml at line 21, actionlint is flagging the custom
runner label "blacksmith-2vcpu-ubuntu-2404-arm" because it doesn't know custom
self-hosted labels; fix by adding an actionlint config file named
actionlint.yaml at repo root that defines self-hosted-runner.labels and includes
"blacksmith-2vcpu-ubuntu-2404-arm" (and the related
"blacksmith-2vcpu-ubuntu-2404") so actionlint recognizes them, or alternatively
remove/replace the custom label in the workflow; ensure the config key is
exactly self-hosted-runner: labels: [ ... ] and commit it alongside the
workflow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/tests.yml:
- Line 21: actionlint is flagging the custom runner label
"blacksmith-2vcpu-ubuntu-2404-arm" because it doesn't know custom self-hosted
labels; fix by adding an actionlint config file named actionlint.yaml at repo
root that defines self-hosted-runner.labels and includes
"blacksmith-2vcpu-ubuntu-2404-arm" (and the related
"blacksmith-2vcpu-ubuntu-2404") so actionlint recognizes them, or alternatively
remove/replace the custom label in the workflow; ensure the config key is
exactly self-hosted-runner: labels: [ ... ] and commit it alongside the
workflow.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 382b7405-faec-4337-891f-f1bd532d04d9

📥 Commits

Reviewing files that changed from the base of the PR and between 45a771c and 6870e4b.

📒 Files selected for processing (4)
  • .github/workflows/release.yml
  • .github/workflows/tests.yml
  • .golangci.yml
  • examples/push-image/main.go
✅ Files skipped from review due to trivial changes (2)
  • .golangci.yml
  • examples/push-image/main.go

@pan93412
pan93412 merged commit 596f4e4 into main May 8, 2026
7 checks passed
@pan93412
pan93412 deleted the improve-release branch May 8, 2026 15:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants